package top.kmtec.common;

import lombok.Data;

import java.io.Serializable;

/**
 * @Author FengHuan Wang
 * @Date 2025/2/5 14:03
 * @Version 1.0
 */

/**
 * 通用返回结果
 * @param <T>
 */
@Data
public class BaseResponse<T> implements Serializable {
    private Integer code;
    private T data;
    private String message;
    private String desc;
    public BaseResponse(Integer code, T data, String message, String desc) {
        this.code = code;
        this.data = data;
        this.message = message;
        this.desc = desc;
    }
    public BaseResponse(Integer code, T data) {
        this.code = code;
        this.data = data;
    }
    public BaseResponse(Integer code, T data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }
    public BaseResponse(ErrorCode errorCode) {
        this(errorCode.getCode(), null, errorCode.getMessage(), errorCode.getDesc());
    }
    public BaseResponse(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }
}
